﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BPMS.Utility.RegexExpress
{
    public class RegexPattern
    {
        private RegexPattern()
        {

        }

        /// <summary>
        /// IP
        /// </summary>
        public const string IP = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";

        /// <summary>
        /// Email
        /// </summary>
        public const string Email = @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$";

        /// <summary>
        /// Numeric
        /// </summary>
        public const string Numeric = @"^\-?[0-9]*\.?[0-9]*$";

        /// <summary>
        /// URL
        /// </summary>
        public const string Url = @"^^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=]*)?$";

        /// <summary>
        /// 字母
        /// </summary>
        public const string Alpha = @"^[a-zA-Z]*$";

        /// <summary>
        /// 大写字母
        /// </summary>
        public const string AlphaUpperCase = @"^[A-Z]*$";

        /// <summary>
        /// 小写字母
        /// </summary>
        public const string AlphaLowerCase = @"^[a-z]*$";

        /// <summary>
        /// 字母数字
        /// </summary>
        public const string AlphaNumeric = @"^[a-zA-Z0-9]*$";

        /// <summary>
        /// 字母数字空格
        /// </summary>
        public const string AlphaNumericSpace = @"^[a-zA-Z0-9 ]*$";

        /// <summary>
        /// 字母数字空格 -
        /// </summary>
        public const string AlphaNumericSpaceDash = @"^[a-zA-Z0-9 \-]*$";

        /// <summary>
        /// 字母数字空格 - 下划线
        /// </summary>
        public const string AlphaNumericSpaceDashUnderscore = @"^[a-zA-Z0-9 \-_]*$";

        /// <summary>
        /// 
        /// </summary>
        public const string AlphaNumericSpaceDashUnderscorePeriod = @"^[a-zA-Z0-9\. \-_]*$";

        /// <summary>
        /// 汉字
        /// </summary>
        public const string Chiness = @"^[\u4e00-\u9fa5]$";

        /// <summary>
        /// 邮编
        /// </summary>
        public const string PostCode = @"^[1-9]{1}(\d){5}$";

        /// <summary>
        /// 手机
        /// </summary>
        public const string MobilePhone = @"^(86)*0*(13|15|18)\d{9}$";

        /// <summary>
        /// 固定电话
        /// </summary>
        public const string TelePhone = @"^((\d{3,4})|\d{3,4}-|\s)?\d{8}$";

        /// <summary>
        /// Decimal
        /// </summary>
        public const string DecimalNumbic = @"^[0-9]+/.?[0-9]{0,2}$";

        /// <summary>
        /// 整数
        /// </summary>
        public const string IntNumbic = @"^\d+$";

        /// <summary>
        /// 非法字符1
        /// </summary>
        public const string InvalidData1 = @"(\sand\s)|(\sand\s)|(\slike\s)|(select\s)|(insert\s)|(delete\s)|(update\s[\s\S].*\sset)|(create\s)|(\stable)|(<[iframe|/iframe|script|/script])|(')|(\sexec)|(declare)|(\struncate)|(\smaster)|(\sbackup)|(\smid)|(\scount)|(cast)|(%)|(\sadd\s)|(\salter\s)|(\sdrop\s)|(\sfrom\s)|(\struncate\s)|(\sxp_cmdshell\s)";
        /// <summary>
        /// 非法字符2
        /// </summary>
        public const string Invaliddata2 = @"\b(alert|confirm|prompt)\b|^\+/v(8|9)|\b(and|or)\b.{1,6}?(=|>|<|\bin\b|\blike\b)|/\*.+?\*/|<\s*script\b|<\s*img\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|DATABASE)";
    }
}
